/**
 * 
 */
package sailing.ui.treecell;

import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.EventObject;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.event.CellEditorListener;
import javax.swing.event.EventListenerList;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;

import cjlite.logger.Logger;

import sailing.resource.Resource;
import sailing.ui.systemsetting.model.SubjectTreeNode;

/**
 * @author kevin
 * 
 */
public class SubjectTreeCellRenderer extends DefaultTreeCellRenderer{
	

	private static Logger logger = Logger.thisClass();

	private static ImageIcon folderIcon = Resource.getImageIcon("/ui/tree/tree_folder.png");
	private static ImageIcon leafIocn = Resource.getImageIcon("/ui/tree/tree_leaf.png");

	private static Color selectBgColor = new Color(138, 197, 255);
	private static Color selectBgColor2 = new Color(176, 216, 255);

	/** <code>JTree</code> instance listening too. */
	protected transient JTree tree;

	/** Last path that was selected. */
	protected transient TreePath lastPath;
	
	protected EventListenerList listenerList = new EventListenerList();

	private Object cellValue;

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean,
	 * boolean, boolean, int, boolean)
	 */
	@Override
	public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
			boolean leaf, int row, boolean hasFocus) {

		this.tree = tree;
//		logger.trace("value={0},selected={1},expanded={2},leaf={3},row={4},hasFocus={5}", value, selected, expanded,
//				leaf, row, hasFocus);
		SubjectTreeCell edit = new SubjectTreeCell(value, selected, expanded, leaf, row, false);
		edit.doLayout();

		edit.setName("TreeCell----Renderer----Component");
		edit.setEnabled(true);
		return edit;
	}


}
